//
//  NRWNavigationController.m
//  NRWMall
//
//  Created by 邢毅 on 2018/5/7.
//  Copyright © 2018年 com.anpxd. All rights reserved.
//

#import "NRWNavigationController.h"

#import "NRWLoginPushAnimation.h"

@interface NRWNavigationController ()<UINavigationControllerDelegate>

@end

@implementation NRWNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationBar setHidden:YES];
    
    self.delegate = self;
}

- (UIViewController *)findViewControllerWithClassString:(NSString *)classString {
    
    for (UIViewController *vc in self.viewControllers) {
        
        if ([vc isKindOfClass:NSClassFromString(classString)]) {
            
            return vc;
        }
    }
    return nil;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if (self.viewControllers.count > 0) {
        
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:animated];
}

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC {
    
//    if (operation == UINavigationControllerOperationPush && [toVC isKindOfClass:NSClassFromString(@"NRWLoginVC")]) {
//        
//        toVC.hidesBottomBarWhenPushed = NO;
//        
//        return [NRWLoginPushAnimation new];
//    }
    
    return nil;
}

@end
